﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="author" content="Aowork">
    <meta name="description" content="">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no">

    <title></title>

    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>

    <link href="../css/mobile.css" rel="stylesheet" />
    <link href="//nos.netease.com/vod163/nep.min.css" rel="stylesheet">
    <script src="../js/zepto.min.js"></script>

    <script src="//nos.netease.com/vod163/nep.min.js"></script>

    <script src="../js/common.js"></script>
    <script src="../js/config.js"></script>
    <script src="../js/uiExtend.js"></script>
    <script src="../js/wx_config.js"></script>

    <script type="text/javascript">
        window.lectureId = jc.hash.get("lectureId");
        if (!window.lectureId) {
            window.location.href = window.ctx + "index/index.html";
        }
    </script>


    <script type="text/javascript">
        jc.fnInit.push(function () {
            jc.ui.header.trigger("updateTitle", "");
            if (jc.hash.get("isShare")) {
                jc.ui.header.trigger("hideReturn");
            }
        });
    </script>


    <script type="text/javascript">
        $.getJSON(window.path.lecture, { lectureId: window.lectureId }, function (result) {

            if (!result.success) {
                alert(result.desc);
            }

            var data = result.data;
            var title = data.title;
            var courseId = data.courseId

            /* 点播统计 */
            jc.ui.header.trigger("getUser", function (user) {
                $.post(window.path.viewVideo, {
                    courseId: courseId,
                    lectureId: window.lectureId,
                    userId: (user && user.uid) || ""
                }, function (data) {
                    //ignore
                }, "json");
            }, true);


            $.getJSON(window.path.course, { courseId: courseId }, function (result) {
                result.data.title = data.title;
                jc.ui.freeOver.trigger("setup", result.data);
            });

            jc.ui.header.trigger("updateTitle", data.title);


            /* 试听权限控制 */
            jc.ui.header.trigger("getUser", function (user) {
                var user = user || {};
                $.getJSON(window.path.viewCheck, {
                    lectureId: window.lectureId,
                    courseId: courseId,
                    u: user.uid || jc.cookie.get("u"),
                    accessToken: user.accessToken || "",
                    r: new Date().getTime() + parseInt(Math.random() * 9999999)

                }, function (result) {
                    if (result.success) {
                        if (result.data <= 0) {
                            jc.ui.video.trigger("freeOver");
                        }
                        else {
                            jc.ui.video.trigger("setupFree", result.data);
                            $.getJSON(window.path.videoUrl, { lectureId: window.lectureId }, function (result) {
                                var data = result.data;
                                if (data.url) {
                                    jc.ui.video.trigger("setup", data.url);
                                }
                            });
                        }
                    }
                    else {
                        alert(result.desc);
                    }

                });
            }, true);
        });
    </script>



</head>
<body>

    <div data-ui="header" class="J_header">
        <div class="h_inner"></div>
    </div>

    <div data-ui="video" class="J_video">
        <div class="v_video">
            <div class="v_ready">精彩马上开始...</div>
        </div>
    </div>


    <div data-ui="freeOver" class="J_freeOver"></div>





</body>
</html>
